package softtest4;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvFileSource;

import static org.junit.jupiter.api.Assertions.assertEquals;
import java.text.ParseException;
public class Billtest {

    @DisplayName(value="决策表用例测试1")//决策表用例测试
    @ParameterizedTest
    @CsvFileSource(resources = "/Decision table test cases1.csv",numLinesToSkip =1,encoding = "UTF-8")
    void test1(int m,String time1,String time2,double expected,String k) throws ParseException {
        Bill1 c1 = new Bill1();
        long minutes = c1.calculateTimeSpan(time1,time2);
        double money = c1.countMoney(minutes);
        assertEquals(expected,money,0.000001);
    }
    @DisplayName(value="决策表用例测试2(开始时间为夏令时，结束时间为冬令时)")//决策表用例测试
    @ParameterizedTest
    @CsvFileSource(resources = "/Decision table test cases2.csv",numLinesToSkip =1,encoding = "UTF-8")
    void test2(int m,String time1,String time2,double expected,String k) throws ParseException {
        Bill2 c1 = new Bill2();
        long minutes = c1.calculateTimeSpan(time1,time2);
        double money = c1.countMoney(minutes);
        assertEquals(expected,money,0.000001);
    }


}
